<template>
  <div>
    <el-form :model="formData" ref="ruleForm1" label-width="180px" class="demo-ruleForm" :inline="true">
        <el-form-item label="工序号" prop="processNo">
          <el-input v-model="formData.processNo" class="width220" disabled></el-input>
        </el-form-item>
        <el-form-item label="工序名称" prop="processName">
          <el-input v-model="formData.processName" class="width220" disabled></el-input>
        </el-form-item>
         <el-form-item label="工时" prop="processTime">
          <el-input v-model="formData.processTime" class="width220" disabled></el-input>
        </el-form-item>
        <el-form-item label="外包工序工时面积单独报价" prop="processPrice">
          <el-input v-model="formData.processPrice" class="width220" disabled></el-input>
        </el-form-item>
        <el-form-item label="件数" prop="nums">
          <el-input v-model="formData.nums" class="width220" disabled></el-input>
        </el-form-item>
        <el-form-item label="优先级" prop="priority">
          <el-input v-model="formData.priority" class="width220" disabled></el-input>
        </el-form-item>
        <el-form-item label="计划完成日期" prop="planCompleteDate">
          <el-date-picker v-model="formData.planCompleteDate" type="datetime"
            format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
           placeholder="计划完成日期" class="width220 noMargin" disabled></el-date-picker>
        </el-form-item>
        <el-form-item label="任务开始时间" prop="startTime">
          <el-date-picker v-model="formData.startTime" type="datetime" 
          format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
          placeholder="任务开始时间" class="width220 noMargin" disabled></el-date-picker>
        </el-form-item>
         <el-form-item label="固定工时" prop="confirmWorkTime" v-if="type==='update'">
          <el-input v-model="formData.confirmWorkTime" :disabled='disabled' class="width220"></el-input>
        </el-form-item>
        <el-form-item label="估工工时" prop="predictWorkTime" v-if="type==='update'">
          <el-input v-model="formData.predictWorkTime"  :disabled='disabled' class="width220"></el-input>
        </el-form-item>
        <el-form-item label="创建人" prop="creatorName" v-if="type==='update'">
          <el-input v-model="formData.creatorName"  disabled class="width220"></el-input>
        </el-form-item>
        <el-form-item label="创建时间" prop="createTime" v-if="type==='update'">
          <el-input v-model="formData.createTime" disabled class="width220"></el-input>
        </el-form-item>
        <el-form-item  class="form-item-block text-center" v-if="!disabled">
          <el-button type="primary" @click="onSubmit()">确认</el-button>
        </el-form-item>
      </el-form>
  </div>
</template>
<script>
import planApi from 'plugins/axios/planApi.js';
import baseApi from 'plugins/axios/baseApi.js';
export default {
  name: 'processPlanDetail',
  props:{
    disabled:{
      type:Boolean,
      default:false
    },
    formData:{
      type:Object
    },
    type:{
      type:String
    },
    tid:{
      type:[String,Number]
    }
  },
  data (){
    return {
    }
  },
  watch:{
    
  },
  created(){
   
  },
  methods:{
    onSubmit(){
      let self = this;
      let postData = JSON.parse(JSON.stringify(self.formData))
      if(self.type==='insert'){
        postData.tid = self.tid;
      }
      planApi.insertUpdatePlanTask(self.type,postData).then(res=>{
        self.$emit('editSuccess'); 
      })
    }
  }
}
</script>
<style lang="stylus" scoped>

</style>